1. Field of the Invention
The present invention generally relates to a digital image processing method, and more particularly, to a shadow detection method.
2. Description of Related Art
In recent years, many countries and governments have been alarmed by the insufficiency of national security information and started to devote themselves to the development of video security monitoring to enhance related security management measures. In addition, along with the increasing consciousness of our society to personal and community securities, the demand to video security monitoring products has been increasing quickly. Moving object detection plays a very important role in existing video monitoring systems. By correctly detecting the size and location of a moving object, the accuracy of subsequent operations (for example, abnormal event analysis and intrusion detection and analysis, etc) can be greatly increased.
In an existing video monitoring system, a moving object is usually captured through background subtraction or other similar digital image processing techniques. However, in the background subtraction technique, a shadow of an object is usually considered a foreground such that the size and location of the object cannot be determined accurately, and accordingly the subsequent analysis may be made difficult. Thus, a video monitoring system should be able to detect and eliminate the shadow of an object after the background of the object is removed.
FIG. 1 is a flowchart of a conventional shadow detection method. In step S110, the color characteristic of a background is subtracted from a foreground object to obtain the characteristic of the image. For example, statistical data of the background is compared with the foreground object to obtain a detection region of the shadow of the corresponding object.
In step S120, a color space transformation is performed to the image. For example, the color representation format in the detection region of the shadow of the object is transformed into corresponding intensity, saturation, and hue.
In step S130, a threshold is manually set according to the transformed image. For example, thresholds of intensity error, hue error, and saturation error are manually set.
In step S140, the shadow is detected in the image according to the threshold, so that the moving object and the shadow thereof can be differentiated. Compared to the background image, the shadow has similar hue but lower intensity. If the pixel value of a pixel in the transformed image satisfies the threshold which is set according to foregoing object characteristic, the pixel is determined to belong to the shadow; otherwise, the pixel is determined to belong to the object.
According to the conventional shadow detection method, specific parameters regarding specific scenes and light sources have to be manually set in order to correspond to the shadow characteristics of different images. All existing shadow eliminating methods focus on the transformation of color space and the selection of characteristics. However, a good threshold has to be manually set to achieve a good shadow segmentation in the transformed color space or characteristic space. This is mainly because of the variation between images, and the variation of light and shadow is difficult to control even in the same image. However, different ambient lights (for example, scattered light or direct light) produces shadows of very different characteristics in an image, even the intensity of a light may affect the characteristic of its shadow. Accordingly, shadow detection is made very difficult. Conventionally, different parameters are manually set regarding different scenes and different ambient lights so as to satisfy the characteristics of different shadows. However, the conventional technique is very difficult and inconvenient to be actually applied.